package cn.lijiajia3515.cairo.auth.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("")
public class IndexController {

	@GetMapping(value = {"/authentication", "/userinfo"})
	@PreAuthorize("isAuthenticated()")
	public Object authentication(@AuthenticationPrincipal Object account) {
		return account;
	}

	@GetMapping("/test")
	@PreAuthorize("hasRole('a')")
	public String d(){
		return "d";
	}

}
